def is_valid_bracket_sequence(sequence):
    stack = []
    opening_brackets = '({[<'
    closing_brackets = ')}]>'

    for bracket in sequence:
        if bracket in ' ':
            continue
        elif bracket in opening_brackets:
            stack.append(bracket)
        elif bracket in closing_brackets:
            if not stack or opening_brackets[closing_brackets.index(bracket)] != stack.pop():
                return False

    return not stack


bracket_sequence = input("Введите скобочную последовательность: ")
result = is_valid_bracket_sequence(bracket_sequence)
print(result)
